param = {
	"add": [{
		"827322": {
			"value": "Asdfa",
			"name": "Color"
		},
		"827323": {
			"value": "Asdf",
			"name": "Size"
		}
	}],
	"delete": ["4267371"],
	"mod": [{
		"827322": {
			"value": "Gary",
			"name": "Color",
			"value_id": 2817378
		},
		"827323": {
			"value": "Lwerwe",
			"name": "Size",
			"value_id": 2817381
		},
		"sku_id": 4267375
	}],
	"attr": [{
		"name": "Color",
		"attr_id": "827322"
	}, {
		"name": "Size",
		"attr_id": "827323"
	}],
	"product_no": "BCS000023401N"
}

        
from schema import Schema, And, Use, Optional

schema = Schema([{'name': And(str, len),
                  'age':  And(Use(int), lambda n: 18 <= n <= 99),
                  Optional('gender'): And(str, Use(str.lower),
                                          lambda s: s in ('squid', 'kid'))}])


data = [{'name': 'Sue', 'age': '28', 'gender': 'Squid'},
        {'name': 'Sam', 'age': '42'},
        {'name': 'Sacha', 'age': '20', 'gender': 'KID'}]


validated = schema.validate(data)



assert validated == [{'name': 'Sue', 'age': 28, 'gender': 'squid'},
                     {'name': 'Sam', 'age': 42},
                     {'name': 'Sacha', 'age' : 20, 'gender': 'kid'}]